"use client";
import { useEventPoint } from "@/hooks/useEventPoint";
import { usePathname } from "@/i18n/routing";
import { useEffect } from "react";

/**
 * @description 主页初始化
 */
const Page = () => {
    useEventPoint();

    // 获取分享id
    const pathname = usePathname();
    useEffect(() => {
        localStorage.setItem("channel_code", window.location.href);

        const [, shareId] = pathname.split("/");
        if (!shareId || shareId === "xxxxxx") return;
        if (shareId.length !== 8) {
            sessionStorage.removeItem("shareId");
            return;
        }
        sessionStorage.setItem("shareId", shareId);
    }, []);
    return null;
};

export default Page;
